//
// Copyright (C) 2011 - 2013  Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.2 with QuantLib 1.2.1
//#include "stdafx.h"
#include "BTP.h"
using namespace Cephei::QL::Instruments::Bonds;
#include <gen/QL/Times/DayCounter.h>
#include <gen/QL/Times/Schedule.h>
#include <gen/QL/InterestRate.h>
#include <gen/QL/Times/Calendar.h>
#include <gen/QL/Times/Period.h>
#include <gen/QL/CashFlow.h>
#include <gen/QL/PricingEngine.h>
#include <gen/QL/Instruments/Bonds/FixedRateBond.h>
using namespace Cephei::QL::Times;
using namespace Cephei::QL;
#define HANDLE
#undef ABSTRACT
#undef STRUCT
Cephei::QL::Instruments::Bonds::CBTP::CBTP (DateTime maturityDate, Double fixedRate, Double redemption, Microsoft::FSharp::Core::FSharpOption<DateTime>^ startDate, Microsoft::FSharp::Core::FSharpOption<DateTime>^ issueDate, Cephei::QL::IPricingEngine^ QL_Pricer) : CFixedRateBond(CBTP::typeid)
{
    try
    {
#ifdef HANDLE
        _phBTP = NULL;
#endif
        QuantLib::Date _maturityDate = (QuantLib::Date)ValueHelper::Convert (maturityDate); //d
        QuantLib::Rate _fixedRate = (QuantLib::Rate)ValueHelper::Convert (fixedRate); //d
        QuantLib::Real _redemption = (QuantLib::Real)ValueHelper::Convert (redemption); //d
        QuantLib::Date _startDate = 
            (Microsoft::FSharp::Core::FSharpOption<DateTime>::IsSome::get (startDate) ? (QuantLib::Date)ValueHelper::Convert (startDate->Value) : QuantLib::Date()); //4
        QuantLib::Date _issueDate = 
            (Microsoft::FSharp::Core::FSharpOption<DateTime>::IsSome::get (issueDate) ? (QuantLib::Date)ValueHelper::Convert (issueDate->Value) : QuantLib::Date()); //4
        _ppBTP = new boost::shared_ptr<QuantLib::BTP> (new QuantLib::BTP ( _maturityDate,  _fixedRate,  _redemption,  _startDate,  _issueDate ));
        CPricingEngine^ _CQL_Pricer = safe_cast<CPricingEngine^> (QL_Pricer);
        boost::shared_ptr<QuantLib::PricingEngine>& _QL_Pricer = static_cast<boost::shared_ptr<QuantLib::PricingEngine>&> (_CQL_Pricer->GetShared ());
        (*_ppBTP)->setPricingEngine (_QL_Pricer);
        SetFixedRateBond (boost::dynamic_pointer_cast<QuantLib::FixedRateBond> (*_ppBTP));
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Instruments::Bonds::CBTP::CBTP (DateTime maturityDate, Double fixedRate, Microsoft::FSharp::Core::FSharpOption<DateTime>^ startDate, Microsoft::FSharp::Core::FSharpOption<DateTime>^ issueDate, Cephei::QL::IPricingEngine^ QL_Pricer) : CFixedRateBond(CBTP::typeid)
{
    try
    {
#ifdef HANDLE
        _phBTP = NULL;
#endif
        QuantLib::Date _maturityDate = (QuantLib::Date)ValueHelper::Convert (maturityDate); //d
        QuantLib::Rate _fixedRate = (QuantLib::Rate)ValueHelper::Convert (fixedRate); //d
        QuantLib::Date _startDate = 
            (Microsoft::FSharp::Core::FSharpOption<DateTime>::IsSome::get (startDate) ? (QuantLib::Date)ValueHelper::Convert (startDate->Value) : QuantLib::Date()); //4
        QuantLib::Date _issueDate = 
            (Microsoft::FSharp::Core::FSharpOption<DateTime>::IsSome::get (issueDate) ? (QuantLib::Date)ValueHelper::Convert (issueDate->Value) : QuantLib::Date()); //4
        _ppBTP = new boost::shared_ptr<QuantLib::BTP> (new QuantLib::BTP ( _maturityDate,  _fixedRate,  _startDate,  _issueDate ));
        CPricingEngine^ _CQL_Pricer = safe_cast<CPricingEngine^> (QL_Pricer);
        boost::shared_ptr<QuantLib::PricingEngine>& _QL_Pricer = static_cast<boost::shared_ptr<QuantLib::PricingEngine>&> (_CQL_Pricer->GetShared ());
        (*_ppBTP)->setPricingEngine (_QL_Pricer);
        SetFixedRateBond (boost::dynamic_pointer_cast<QuantLib::FixedRateBond> (*_ppBTP));
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Instruments::Bonds::CBTP::CBTP (boost::shared_ptr<QuantLib::BTP>& childNative, Object^ owner) : CFixedRateBond(CBTP::typeid)
{
#ifdef HANDLE
	_phBTP = NULL;
#endif
	_ppBTP = &childNative;
    _ppFixedRateBond = new boost::shared_ptr<QuantLib::FixedRateBond> (boost::dynamic_pointer_cast<QuantLib::FixedRateBond> (*_ppBTP));
}
Cephei::QL::Instruments::Bonds::CBTP::CBTP (QuantLib::BTP& childNative, Object^ owner) : CFixedRateBond(CBTP::typeid)
{
#ifdef HANDLE
	_phBTP = NULL;
#endif
	_ppBTP = new boost::shared_ptr<QuantLib::BTP> (&childNative);
    _ppFixedRateBond = new boost::shared_ptr<QuantLib::FixedRateBond> (boost::dynamic_pointer_cast<QuantLib::FixedRateBond> (*_ppBTP));
    _BTPOwner = owner;
    _FixedRateBondOwner = owner;
}

Cephei::QL::Instruments::Bonds::CBTP::CBTP (CBTP^ copy) : CFixedRateBond(CBTP::typeid)
{
#ifdef HANDLE
	_phBTP = NULL;
#endif
	if (copy->HasNative() != NULL)
    {
		_ppBTP = new boost::shared_ptr<QuantLib::BTP> (copy->GetShared());
        _ppFixedRateBond = new boost::shared_ptr<QuantLib::FixedRateBond> (boost::dynamic_pointer_cast<QuantLib::FixedRateBond> (*_ppBTP));
    }
}
Cephei::QL::Instruments::Bonds::CBTP::CBTP (PLATFORM::Type^ t) : CFixedRateBond(CBTP::typeid)
{
#ifdef HANDLE
	_phBTP = NULL;
#endif
	if (!t->IsSubclassOf(CBTP::typeid))
		throw REFNEW Exception ("Invalid base-case init");
}
#ifdef HANDLE
Cephei::QL::Instruments::Bonds::CBTP::CBTP (QuantLib::Handle<QuantLib::BTP>& childNative, Object^ owner)  : CFixedRateBond(CBTP::typeid)
{
	_phBTP = &childNative;
	_ppBTP = &static_cast<boost::shared_ptr<QuantLib::BTP>>(childNative.currentLink());
    _ppFixedRateBond = new boost::shared_ptr<QuantLib::FixedRateBond> (boost::dynamic_pointer_cast<QuantLib::FixedRateBond> (*_ppBTP));
    _BTPOwner = owner;
}
Cephei::QL::Instruments::Bonds::CBTP::CBTP (QuantLib::Handle<QuantLib::BTP> childNative)  : CFixedRateBond(CBTP::typeid)
{
	_phBTP = &childNative;
	_ppBTP = &static_cast<boost::shared_ptr<QuantLib::BTP>>(childNative.currentLink());
    _ppFixedRateBond = new boost::shared_ptr<QuantLib::FixedRateBond> (boost::dynamic_pointer_cast<QuantLib::FixedRateBond> (*_ppBTP));
}
#endif
#ifdef STRUCT
Cephei::QL::Instruments::Bonds::CBTP::CBTP (QuantLib::BTP childNative)  : CFixedRateBond(CBTP::typeid)
{
#ifdef HANDLE
	_phBTP = NULL;
#endif
	_ppBTP = new boost::shared_ptr<QuantLib::BTP> (new QuantLib::BTP (childNative));
    _ppFixedRateBond = new boost::shared_ptr<QuantLib::FixedRateBond> (boost::dynamic_pointer_cast<QuantLib::FixedRateBond> (*_ppBTP));
}
#endif

Cephei::QL::Instruments::Bonds::CBTP::~CBTP ()
{
    if (_ppBTP != NULL)
    {
	    delete _ppBTP;
        _ppBTP = NULL;
    }
}
Cephei::QL::Instruments::Bonds::CBTP::!CBTP ()
{
    if (_ppBTP != NULL)
    {
	    delete _ppBTP;
    }
}
QuantLib::BTP& Cephei::QL::Instruments::Bonds::CBTP::GetReference ()
{
    if (_ppBTP == NULL) throw REFNEW NativeNullException ();
	return **_ppBTP;
}
boost::shared_ptr<QuantLib::BTP>& Cephei::QL::Instruments::Bonds::CBTP::GetShared ()
{
    if (_ppBTP == NULL) throw REFNEW NativeNullException ();
	return *_ppBTP;
}
QuantLib::BTP* Cephei::QL::Instruments::Bonds::CBTP::GetPointer ()
{
    if (_ppBTP == NULL) throw REFNEW NativeNullException ();
	return &**_ppBTP;
}
#ifdef HANDLE
QuantLib::Handle<QuantLib::BTP>& Cephei::QL::Instruments::Bonds::CBTP::GetHandle ()
{
	if (_phBTP == NULL)
	{
		_phBTP = new Handle<QuantLib::BTP> (*_ppBTP);
	}
	return *_phBTP;
}
#endif
bool Cephei::QL::Instruments::Bonds::CBTP::HasNative () 
{
	return (_ppBTP != NULL);
}

Double Cephei::QL::Instruments::Bonds::CBTP::AccruedAmount (Microsoft::FSharp::Core::FSharpOption<DateTime>^ d)
{
    try
    {
        QuantLib::Date _d = 
            (Microsoft::FSharp::Core::FSharpOption<DateTime>::IsSome::get (d) ? (QuantLib::Date)ValueHelper::Convert (d->Value) : QuantLib::Date()); //9a
    	QuantLib::Real _rv = (QuantLib::Real)(*_ppBTP)->accruedAmount ( _d );   
        Double _nrv = (Double)ValueHelper::Convert (_rv); //c
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Double Cephei::QL::Instruments::Bonds::CBTP::Yield (Double cleanPrice, Microsoft::FSharp::Core::FSharpOption<DateTime>^ settlementDate, Microsoft::FSharp::Core::FSharpOption<Double>^ accuracy, Microsoft::FSharp::Core::FSharpOption<UInt64>^ maxEvaluations)
{
    try
    {
        QuantLib::Real _cleanPrice = (QuantLib::Real)ValueHelper::Convert (cleanPrice); //a
        QuantLib::Date _settlementDate = 
            (Microsoft::FSharp::Core::FSharpOption<DateTime>::IsSome::get (settlementDate) ? (QuantLib::Date)ValueHelper::Convert (settlementDate->Value) : QuantLib::Date()); //9a
        QuantLib::Real _accuracy = 
            (Microsoft::FSharp::Core::FSharpOption<Double>::IsSome::get (accuracy) ? (QuantLib::Real)ValueHelper::Convert (accuracy->Value) : 1.0e-8); //9a
        QuantLib::Size _maxEvaluations = 
            (Microsoft::FSharp::Core::FSharpOption<UInt64>::IsSome::get (maxEvaluations) ? (QuantLib::Size)ValueHelper::Convert (maxEvaluations->Value) : 100); //9a
    	QuantLib::Rate _rv = (QuantLib::Rate)(*_ppBTP)->yield ( _cleanPrice,  _settlementDate,  _accuracy,  _maxEvaluations );   
        Double _nrv = (Double)ValueHelper::Convert (_rv); //c
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Instruments::Bonds::CBTPVector::CBTPVector ()
{
#ifdef STRUCT
	_pVValue = NULL;
#endif
	_pVBoost = NULL;
#ifdef HANDLE
	_pVHand = NULL;
#endif
}
Cephei::QL::Instruments::Bonds::CBTPVector::~CBTPVector ()
{
#ifdef STRUCT
	if (_pVValue != NULL) delete _pVValue;
	_pVValue = NULL;
#endif   
	if (_pVBoost != NULL) delete _pVBoost;
	_pVBoost = NULL;
#ifdef HANDLE
	if (_pVHand != NULL) delete _pVHand;
	_pVHand = NULL;
#endif
}
Cephei::QL::Instruments::Bonds::CBTPVector::!CBTPVector ()
{
#ifdef STRUCT
	if (_pVValue != NULL) delete _pVValue;
#endif   
	if (_pVBoost != NULL) delete _pVBoost;
#ifdef HANDLE
	if (_pVHand != NULL) delete _pVHand;
#endif
}
#ifdef STRUCT
Cephei::QL::Instruments::Bonds::CBTPVector::CBTPVector (std::vector<QuantLib::BTP>& vec, Object^ owner)
{
#ifdef STRUCT
	_pVValue = NULL;
#endif
	_pVBoost = NULL;
#ifdef HANDLE
	_pVHand = NULL;
#endif
	_pVValue = &vec;
	_owner = owner;
}
Cephei::QL::Instruments::Bonds::CBTPVector::CBTPVector (std::vector<QuantLib::BTP> vec)
{
#ifdef STRUCT
	_pVValue = NULL;
#endif
	_pVBoost = NULL;
#ifdef HANDLE
	_pVHand = NULL;
#endif
	_pVValue = new std::vector<QuantLib::BTP> (vec);
}
#endif
Cephei::QL::Instruments::Bonds::CBTPVector::CBTPVector (std::vector<boost::shared_ptr<QuantLib::BTP>>& vec, Object^ owner)
{
#ifdef STRUCT
	_pVValue = NULL;
#endif
	_pVBoost = NULL;
#ifdef HANDLE
	_pVHand = NULL;
#endif
	 _pVBoost = &vec;
	_owner = owner;
}
#ifdef HANDLE
Cephei::QL::Instruments::Bonds::CBTPVector::CBTPVector (std::vector<QuantLib::Handle<QuantLib::BTP>>& vec, Object^ owner)
{
#ifdef STRUCT
	_pVValue = NULL;
#endif
	_pVBoost = NULL;
#ifdef HANDLE
	_pVHand = NULL;
#endif
	 _pVHand = &vec;
	_owner = owner;
}
#endif

int Cephei::QL::Instruments::Bonds::CBTPVector::Count::get ()
{
#ifdef STRUCT
	if (_pVValue != NULL) 
	{
		return _pVValue->size();
	}
#endif    
	if (_pVBoost != NULL)
	{
		return _pVBoost->size ();
	}
#ifdef HANDLE
	if (_pVHand != NULL)
	{
		return _pVHand->size ();
	}
#endif
	return 0;		// should never happen
}
Cephei::QL::Instruments::Bonds::IBTP^ Cephei::QL::Instruments::Bonds::CBTPVector::default::get (int index) 
{
#ifdef STRUCT
	if (_pVValue != NULL) 
	{
    	if ((size_t)index >= _pVValue->size()) throw REFNEW RangeException ();
		QuantLib::BTP& native = (*_pVValue)[index];
		return REFNEW CBTP (native, this);
	}
#endif    
	if (_pVBoost != NULL)
	{
    	if ((size_t)index >= _pVBoost->size()) throw REFNEW RangeException ();
		QuantLib::BTP& native = *(*_pVBoost)[index];
		return REFNEW CBTP (native, this);
	}
#ifdef HANDLE
	if (_pVHand != NULL)
	{
    	if ((size_t)index >= _pVHand->size()) throw REFNEW RangeException ();
		QuantLib::BTP& native = *((*_pVHand)[index].currentLink ());
		return REFNEW CBTP (native, this);
	}
#endif
	return nullptr;		// can never be the case
}
void Cephei::QL::Instruments::Bonds::CBTPVector::default::set (int index, Cephei::QL::Instruments::Bonds::IBTP^ value) 
{
#ifdef STRUCT
	if (_pVValue != NULL)
	{
		if (_pVValue->size() <= (size_t)index)
		{
			// can't happen because vectors are filled from List<> sequentially
			if (_pVValue->size() < (size_t)index)
			{
				throw REFNEW RangeException ();
			}
			_pVValue->push_back (dynamic_cast<CBTP^>(value)->GetReference ());
		}
        else
        {
            QuantLib::BTP& c = (*_pVValue)[index];
            c = dynamic_cast<CBTP^>(value)->GetReference ();
        }
	}
#endif   
	if (_pVBoost != NULL)
	{
		if (_pVBoost->size() <= (size_t)index)
		{
			// can't happen because vectors are filled from List<> sequentially
			if (_pVBoost->size() < (size_t)index)
			{
				throw REFNEW RangeException ();
			}
			_pVBoost->push_back (dynamic_cast<CBTP^>(value)->GetShared ());
		}
		boost::shared_ptr<QuantLib::BTP>& c = (*_pVBoost)[index];
		c = dynamic_cast<CBTP^>(value)->GetShared ();
	}
#ifdef HANDLE
	if (_pVHand != NULL)
	{
		if (_pVHand->size() <= (size_t)index)
		{
			// can't happen because vectors are filled from List<> sequentially
			if (_pVHand->size() < (size_t)index)
			{
				throw REFNEW RangeException ();
			}
			_pVHand->push_back (QuantLib::Handle<QuantLib::BTP> ());
		}
		QuantLib::Handle<QuantLib::BTP>& c = (*_pVHand)[index];
		boost::shared_ptr<QuantLib::BTP>& b = static_cast<boost::shared_ptr<QuantLib::BTP>>(c.currentLink());
		b = dynamic_cast<CBTP^>(value)->GetShared ();
	}
#endif
}
Cephei::Core::Generic::ICoCell<Cephei::QL::Instruments::Bonds::IBTP^>^ Cephei::QL::Instruments::Bonds::CBTPVector::CItem::get (int index) 
{
	return CellFactory::Instance->Create<IBTP^> (dynamic_cast<IBTP^>(default[index]));
}

void Cephei::QL::Instruments::Bonds::CBTPVector::CItem::set (int index, Cephei::Core::Generic::ICoCell<Cephei::QL::Instruments::Bonds::IBTP^>^ value) 
{
	default[index] = safe_cast<IBTP^>(value->Value);
}
#ifdef STRUCT
std::vector<QuantLib::BTP>& Cephei::QL::Instruments::Bonds::CBTPVector::GetReference ()
{
	 return *_pVValue;
}
#endif

std::vector<boost::shared_ptr<QuantLib::BTP>>& Cephei::QL::Instruments::Bonds::CBTPVector::GetShared ()
{
	return *_pVBoost;
}

#ifdef HANDLE
std::vector<QuantLib::Handle<QuantLib::BTP>>& Cephei::QL::Instruments::Bonds::CBTPVector::GetHandle ()
{
	return *_pVHand;
}
#endif
bool Cephei::QL::Instruments::Bonds::CBTPVector::PrepareFeature (NativeFeature feature)
{
	switch (feature)
	{
#ifdef STRUCT
		case NativeFeature::Value :
			if (_pVValue == NULL)
			{
				_pVValue = new std::vector<QuantLib::BTP> ();
				return true;
			}
			break;
#endif
        case NativeFeature::shared_ptr :
			if (_pVBoost == NULL)
			{
				_pVBoost = new std::vector<boost::shared_ptr<QuantLib::BTP>> ();
				return true;
			}
			break;
#ifdef HANDLE
        case NativeFeature::Handle :
            if (_pVHand == NULL)
            {
                _pVHand = new std::vector<QuantLib::Handle<QuantLib::BTP>> ();
                return true;
            }
            break;
#endif
	}
	return false;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Factory class

Cephei::QL::Instruments::Bonds::IBTP^ Cephei::QL::Instruments::Bonds::CBTP_Factory::Create (DateTime maturityDate, Double fixedRate, Double redemption, Microsoft::FSharp::Core::FSharpOption<DateTime>^ startDate, Microsoft::FSharp::Core::FSharpOption<DateTime>^ issueDate, Cephei::QL::IPricingEngine^ QL_Pricer)
{
    return REFNEW CBTP ( maturityDate,  fixedRate,  redemption,  startDate,  issueDate,  QL_Pricer);
}
Cephei::QL::Instruments::Bonds::IBTP^ Cephei::QL::Instruments::Bonds::CBTP_Factory::Create (DateTime maturityDate, Double fixedRate, Microsoft::FSharp::Core::FSharpOption<DateTime>^ startDate, Microsoft::FSharp::Core::FSharpOption<DateTime>^ issueDate, Cephei::QL::IPricingEngine^ QL_Pricer)
{
    return REFNEW CBTP ( maturityDate,  fixedRate,  startDate,  issueDate,  QL_Pricer);
}
/* <summary>Create a single dimension array of BTP that can be passed into other function </summary> */
IVector<Cephei::QL::Instruments::Bonds::IBTP^>^ Cephei::QL::Instruments::Bonds::CBTP_Factory::CreateVector ()
 {
	 return REFNEW CoVector<IBTP^> (REFNEW CBTPVector ());
 }
IVector<Cephei::QL::Instruments::Bonds::IBTP^>^ Cephei::QL::Instruments::Bonds::CBTP_Factory::CreateVector (PLATFORM::Collections::Generic::IEnumerable<IBTP^>^ source)
 {
	 return REFNEW CoVector<IBTP^> (source, REFNEW CBTPVector ());
 }
/* <summary>Create a single dimension array of BTP with change events</summary> */
Cephei::Core::Generic::ICoCell<IVector<Cephei::Core::Generic::ICoCell<Cephei::QL::Instruments::Bonds::IBTP^>^>^>^ Cephei::QL::Instruments::Bonds::CBTP_Factory::CreateCellVector ()
 {
	 return CellFactory::Instance->Create<IVector<Cephei::Core::Generic::ICoCell<Cephei::QL::Instruments::Bonds::IBTP^>^>^> (REFNEW CoCellVector<Cephei::QL::Instruments::Bonds::IBTP^> (REFNEW CBTPVector ()));
 }
Cephei::Core::Generic::ICoCell<IVector<Cephei::Core::Generic::ICoCell<Cephei::QL::Instruments::Bonds::IBTP^>^>^>^ Cephei::QL::Instruments::Bonds::CBTP_Factory::CreateCellVector (PLATFORM::Collections::Generic::IEnumerable<Cephei::Core::Generic::ICoCell<Cephei::QL::Instruments::Bonds::IBTP^>^>^ source)
 {
	 return CellFactory::Instance->Create<IVector<Cephei::Core::Generic::ICoCell<Cephei::QL::Instruments::Bonds::IBTP^>^>^> (REFNEW CoCellVector<Cephei::QL::Instruments::Bonds::IBTP^> (source, REFNEW CBTPVector ()));
 }

